package com.lv.service.impl;

import com.lv.mapper.TbSellerMapper;
import com.lv.pojo.TbSeller;
import com.lv.service.SellerService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
@DubboService
public class SellerServiceImpl implements SellerService {
    @Resource
    private TbSellerMapper sm;

    @Override
    public TbSeller selectById(String sellerId) {
        return sm.selectByPrimaryKey(sellerId);
    }

    @Override
    public Integer add(TbSeller s) {
        return sm.insertSelective(s);
    }

    @Override
    public List<TbSeller> getInfo() {
        return sm.selectByExample(null);
    }

    @Override
    public Integer up(String[] ids, String status) {
        for (String id: ids){
            TbSeller seller = sm.selectByPrimaryKey(id);
            seller.setStatus(status);
            sm.updateByPrimaryKeySelective(seller);
        }
        return 1;
    }

    @Override
    public TbSeller getInfoByUname(String username) {
        return sm.selectByname(username);
    }
}
